//
//  CurriculumSignedCell.m
//  优学荟管理系统
//
//  Created by 星道 on 17/7/18.
//  Copyright © 2017年 星道三好. All rights reserved.
//

#import "CurriculumSignedCell.h"

@implementation CurriculumSignedCell
{
    IBOutlet UILabel *_Name;
    IBOutlet UILabel *_Times;
    IBOutlet UIButton *_Select;
    __weak IBOutlet UILabel *_isHoliday;
}

/**
 选择
 */
- (IBAction)ClickSelct:(UIButton *)sender {
    
    self.ClickSelect(sender);
}




- (instancetype (^)(ZYCourseAttendanceTowModel *))Model {
    
    return ^(ZYCourseAttendanceTowModel *Model) {
        
        self.TowModel = Model;
        self.TowButton = _Select;
        
        _Name.text = Model.user_petName;
        _Times.text = Model.IsAddStudent?Model.user_username:Model.record;
        
        
        
        //        //1.没签到且没有缺席才可以显示选择框
        //        if ([Model.isSign isEqualToNumber:@1] &&   ) {
        //            _Select.hidden = NO;
        //            _Select.selected = [Model.isSign isEqualToNumber:@1]?NO:YES;
        //        } else {
        //            _Select.hidden = YES;
        //        }
        //
        
        if ([[NSString stringWithFormat:@"%@",Model.todayAbsence] integerValue] == 0) {
            _isHoliday.text = @"否";
        } else {
            _isHoliday.text = @"是";
        }
        
        //2已签到 设为选中 1未签到，设为未选中
        if ([Model.isSign isEqualToNumber:@3])
        {
            _Select.hidden = YES;
        } else if([[NSString stringWithFormat:@"%@",Model.todayAbsence] integerValue] > 0) {
            _Select.hidden = YES;
        }
        
        else {
            
            _Select.hidden = NO;
            _Select.selected = [Model.isSign isEqualToNumber:@1]?NO:YES;
        }
        
        return self;
    };
}
@end

